package com.example.nep.controller;

import com.example.nep.base.R;
import com.example.nep.model.Aqi;
import com.example.nep.service.IAqiService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: 韩建平
 * @Description: TODO
 * @DateTime: 2024/4/11 15:20
 **/
@CrossOrigin
@RestController
@RequestMapping("aqiMap")
public class AqiController {
    @Resource
    private IAqiService aqiService;
    @GetMapping("aqiDetail")
    public R findAqi(@RequestParam Integer type,@RequestParam Integer value){
        Aqi aqi = aqiService.findAqi(type, value);
        if (aqi!=null){
            return R.ok().setResult("aqi",aqi);
        }else {
            return R.error();
        }
    }
    @GetMapping("aqiAll")
    public R aqiAll(){
        List<Aqi> list = aqiService.list();
        return R.ok().setResult("aqi",list);
    }





}
